#pragma once
#include <map>
#include <string>
#include <memory>
#include "tinyxml2.h"
#include "interfaces.h"

typedef ActorComponent* (*ActorComponentCreator)(void);
typedef std::map<ComponentId, ActorComponentCreator> ActorComponentCreatorMap;

class ActorFactory
{
	ActorId m_lastActorId;

protected:
	ActorComponentCreatorMap m_actorComponentCreators;

public:
	ActorFactory();
	StrongActorPtr CreateActor(const char* actorResource);

protected:
//if override, call baseclass function first
	virtual StrongActorComponentPtr VCreateComponent(tinyxml2::XMLElement* pData);

private:
	ActorId GetNextActorId() { ++m_lastActorId; return m_lastActorId; }
};
